(function($) {
	$(window).load(function(e) {
		
		$('[name="tahun"]').val($('#tahun').val());
		$('[name="bulan"]').val($('#bulan').val());
		
		$("table#da-ex-datatable-numberpaging").dataTable({
			"aaSorting": [[ 0, "asc" ]],
			"aoColumns": [
				null,
				null,
				null,
				null,
				null
			],
			"oLanguage": {
                "sUrl": "plugins/datatables/dataTables.indonesian.txt"
            },
			sPaginationType: "full_numbers"	
		});
		
			
		var oTable = $('#da-ex-datatable-numberpaging').dataTable( );
		var arr = oTable.fnGetData();
		
		var s1 = new Array();
		var s2 = new Array();
		var s3 = new Array();
		var ticks = new Array();
		
		for(var i=0;i<arr.length;i++){
			s1[i] = arr[i][2];
			s2[i] = arr[i][3];
			s3[i] = arr[i][4];
			ticks[i] = arr[i][1];
		}
		// Can specify a custom tick Array.
		// Ticks should match up one for each y value (category) in the series.
		 
		var plot1 = $.jqplot('chart-beban-jaksa', [s1, s2, s3], {
			// The "seriesDefaults" option is an options object that will
			// be applied to all series in the chart.
			seriesDefaults:{
				renderer:$.jqplot.BarRenderer,
				rendererOptions: {fillToZero: true}
			},
			// Custom labels for the series are specified with the "label"
			// option on the series option.  Here a series option object
			// is specified for each series.
			series:[
				{label:'Jumlah Perkara Belum Selesai'},
				{label:'Jumlah Perkara Sudah Selesai'},
				{label:'Beban Perkara'}
			],
			// Show the legend and put it outside the grid, but inside the
			// plot container, shrinking the grid to accomodate the legend.
			// A value of "outside" would not shrink the grid and allow
			// the legend to overflow the container.
			legend: {
				show: true,
				placement: 'outsideGrid'
			},
			axes: {
				// Use a category axis on the x axis and use our custom ticks.
				xaxis: {
					renderer: $.jqplot.CategoryAxisRenderer,
					ticks: ticks
				}
			}
		});
	
	});
}) (jQuery);
